[Feat] : 출석체크 모달 상태 부모 관리 및 첫 접속 시 자동 오픈 (#182)#183
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Review Summary by QodoMove check-in modal state to parent and auto-open on first login
WalkthroughsDescription• Move check-in logic from CheckInModal to Header parent component • Add isCheckedIn prop to CheckInModal for cleaner state management • Auto-open check-in modal on first login if not checked in • Update FallingIcons styling from background to border • Format and sitemap updates Diagramflowchart LR
Header["Header Component"]
Logic["Date Comparison Logic"]
CheckInModal["CheckInModal Component"]
AutoOpen["Auto-open on First Login"]
Header -- "calculates isCheckedIn" --> Logic
Logic -- "passes isCheckedIn prop" --> CheckInModal
Header -- "useEffect checks user state" --> AutoOpen
AutoOpen -- "setOpen true" --> CheckInModal
File Changes1. apps/web/src/Header.tsx
|
Code Review by QodoNew Review StartedThis review has been superseded by a new analysisⓘ The new review experience is currently in Beta. Learn more |
|
/describe |
|
/review |
|
/improve |
Code Review by QodoNew Review StartedThis review has been superseded by a new analysisⓘ The new review experience is currently in Beta. Learn more |
Code Review by Qodo
|
|
PR Description updated to latest commit (2628da5)
|
| const lastCheckIn = user?.last_check_in ?? new Date(); | ||
| const today = format(new Date(), 'yyyy-MM-dd'); | ||
| const isCheckedIn = format(new Date(lastCheckIn), 'yyyy-MM-dd') >= today; |
There was a problem hiding this comment.
1. Null check-in treated done 🐞 Bug ≡ Correctness
Header에서 last_check_in이 null인 경우 lastCheckIn을 new Date()로 대체해 isCheckedIn이 true가 되어, 실제로는 미출석인데도 자동 오픈이 되지 않고 모달이 DONE 상태로 초기화됩니다. last_check_in이 null 가능한 타입 정의와 충돌해 신규/초기 사용자에서 출석 기능이 비활성화될 수 있습니다.
Agent Prompt
### Issue description
`last_check_in`이 `null`일 수 있는데도 `?? new Date()`로 오늘 날짜로 치환해버려, 미출석 사용자가 `isCheckedIn=true`로 판정됩니다.
### Issue Context
- `User.last_check_in` 타입은 `Date | null` 입니다.
- 현재 로직은 `null`을 '오늘 출석함'으로 간주합니다.
### Fix Focus Areas
- apps/web/src/Header.tsx[59-64]
- apps/web/src/components/CheckInModal.tsx[16-33]
### Suggested fix direction
- `lastCheckIn`을 `Date | null`로 유지하고, `isCheckedIn` 계산 시 `lastCheckIn`이 없으면 `false`로 처리하세요.
- 예: `const lastCheckIn = user?.last_check_in ?? null;`
- 예: `const isCheckedIn = lastCheckIn ? format(new Date(lastCheckIn), 'yyyy-MM-dd') >= today : false;`
- `CheckInModalProps.lastCheckIn`도 `Date | null`로 바꾸고(`useCheckInTimer`는 이미 `Date | null` 허용), 내부 사용처를 이에 맞게 조정하세요.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
그럼 >=가 아니라 =로 처리하면 되는 거 아니야?
User description
📌 PR 제목
[Feat] : 출석체크 모달 상태 부모 관리 및 첫 접속 시 자동 오픈
📌 변경 사항
parseLastCheckIn >= today)을 CheckInModal에서 Header(부모)로 이동하여isCheckedInprop으로 전달date-fnsimport 및 내부 날짜 비교 변수(today,parseLastCheckIn) 제거bg-amber-50→border로 스타일 변경💬 추가 참고 사항
PR Type
Enhancement
Description
Move check-in logic from modal to parent Header component
Auto-open check-in modal on first visit when not checked in
Pass
isCheckedInprop to CheckInModal for state managementRemove date-fns dependency from CheckInModal component
Update FallingIcons styling and format documentation
Diagram Walkthrough
File Walkthrough
Header.tsx
Move check-in logic to Header and add auto-openapps/web/src/Header.tsx
formatfromdate-fnsfor date comparisontodayandisCheckedInstate in Header componentchecked in
isCheckedInprop to CheckInModal componentCheckInModal.tsx
Remove date logic and accept isCheckedIn propapps/web/src/components/CheckInModal.tsx
date-fnsimport and date comparison logicisCheckedInboolean prop to component interfaceisCheckedInprop usageFallingIcons.tsx
Update FallingIcons background stylingapps/web/src/components/FallingIcons.tsx
bg-amber-50tobordergetSongTag.ts
Reorder imports for consistencypackages/crawling/src/utils/getSongTag.ts
dotenvbeforeOpenAIsitemap-0.xml
Update sitemap timestampapps/web/public/sitemap-0.xml
CLAUDE.md
Fix documentation table formattingpackages/crawling/CLAUDE.md
documentation